package com.mzy.datepackage.M2022.Jan.four;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;

/**
 * @author Ives
 * * @date 2022/1/4
 */
public class Demo {
  /**
   * date转换为当天凌晨零点时间
   *
   * @param date
   * @return
   */
  public static Date getDateZero(Date date) {
    Calendar calendar = Calendar.getInstance();
    calendar.setTime(date);
    calendar.set(Calendar.HOUR_OF_DAY, 0);
    calendar.set(Calendar.MINUTE, 0);
    calendar.set(Calendar.SECOND, 0);
    calendar.set(Calendar.MILLISECOND, 0);
    return calendar.getTime();
  }

  public static void main(String[] args) {
    System.out.println();
    Date dateZero = getDateZero(new Date());
    System.out.println(dateZero);
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MMM-dd-yyyy", Locale.US);
    String format = simpleDateFormat.format(dateZero);
    System.out.println(format);
    String Str = new String("RunoobDDDDDTTT");

    System.out.print("返回值 :" );
    System.out.println(Str.replaceAll("R,D", ""));

    System.out.print("返回值 :" );
    System.out.println(Str.replaceAll("T", ""));
  }



}
